var vm_shenhelist_shenhe = new Vue({
    el : "#shenhelist_shenhe",
    data : {
        deptid : $("#deptid").val(),		// 单位ID
        biandongpiciid : $("#biandongpiciid").val(),

        shenhelist : [],//
        renwuid : '',//
        shenhe : {},//

        //查询用字段
        shenhezhuangtai : '',//0待审核 1通过 2未通过
        jigoumingcheng : '',
        zhuanjiaxingming : '',
        renwuxiafashijian : '',

        pageindex : 1,		// 查询分页初始化页
        pagesize : 10,		// 查询分页初始化页面大小
        pageCount : 0,		// 总页数
        recordCount : 0,	// 总记录数
        targetpage : '', 	// 目标页
    },
    watch : {
        //监控分页情况，刷新列表
        pageindex : function(){
            this.bindShenheList();
        },

        pagesize : function(){
            //
            this.bindShenheList();
        },
    },
    created : function(){
        var _this = this;

        _this.bindShenheList();

    },
    methods : {

        //
        bindShenheList : function(){
            var _this = this;

            var shenhe_layer = layer.open({type:3});
            $.post('/system/renwu/findshenhelist', {
                deptid : _this.deptid,
                shenhezhuangtai : _this.shenhezhuangtai,
                jigoumingcheng : _this.jigoumingcheng,
                zhuanjiaxingming : _this.zhuanjiaxingming,
                renwuxiafashijian : _this.renwuxiafashijian,
                pageindex : _this.pageindex,
                pagesize : _this.pagesize,
                rdm : Math.random()
            },function(ppData) {
                layer.close(shenhe_layer);

                if (ppData != null) {
                    var data = ppData.resultContent;
                    _this.shenhelist = data.shenhelist;

                    var pageInfo = data.PageInfo;
                    _this.pageindex = pageInfo.pageIndex;
                    _this.pageCount = pageInfo.pageCount;
                    _this.recordCount = pageInfo.recordCount;
                    _this.targetpage = '';
                }
            },"json");
        },

        toDetailList : function(ppBiandongpici){
            $.modal.openTab(ppBiandongpici.shenqingdanwei+"专家变动详情",'/system/zhuanjiabiandongdetail/customzhuanjiabiandongdetail_shenhe?piciid='+ppBiandongpici.id+'&renwuid='+ppBiandongpici.renwuid,false);
        },

        showShenhejiluModel:function(ppShiwuId){
            var _this = this;

            $("#shenhejiluModalLabel").html("审核进度");
            $("#shenhejiluModal").modal();

            _this.bindShenhejilu(ppShiwuId);
        },

        bindShenhejilu:function(ppShiwuId){
            var _this = this;

            var biandong_layer = layer.open({type:3});
            $.post('/system/renwu/findshenhejilu', {
                shiwuid : ppShiwuId,
                rdm : Math.random()
            },function(ppData) {
                layer.close(biandong_layer);

                if (ppData != null) {
                    var data = ppData;
                    _this.shenhejilulist = data.resultContent;
                }
            },"json");
        },

        getDate_chaxun:function(){
            var _this = this;

            _this.renwuxiafashijian=$("#renwuxiafashijian_chaxun").val();
        },

        //首页
        firstPage : function(){
            this.pageindex = 1;
        },
        //尾页
        lastPage : function(){
            this.pageindex = this.pageCount;
        },
        //上一页
        prePage : function(){
            var prePage = ((this.pageindex -1) <= 0) ? 1 : (this.pageindex -1);
            this.pageindex = prePage;
        },
        //下一页
        nextPage : function(){
            var nextPage = ((this.pageindex +1) >= this.pageCount) ? this.pageCount : (this.pageindex +1);
            this.pageindex = nextPage;
        },
        //跳到目标页
        targetPage : function() {
            if( this.targetpage != '' && this.targetpage <= this.pageCount && this.targetpage > 0){
                this.pageindex = this.targetpage;
                this.targetpage = '';
            }
        },
    },
});